package com.hupeng.serivce.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;

import com.hupeng.domain.ProductInfo;
import com.hupeng.enums.ProductEnums;
import com.hupeng.repository.ProductInfoRepository;
import com.hupeng.serivce.ProductService;
@Service
public class ProductServiceImpl implements ProductService {
	@Autowired
	private ProductInfoRepository resp;
	@Override
	public ProductInfo findOne(String id) {
		return resp.findById(id).get();
	}

	@Override
	public List<ProductInfo> findUpAll() {
		return resp.findByProductStatus(ProductEnums.UP.getCode());
	}

	@Override
	public Page<ProductInfo> findAll(Pageable pageable) {
		Page<ProductInfo> findAll = resp.findAll(pageable);
		return findAll;
	}

	@Override
	public ProductInfo save(ProductInfo productInfo) {
		return resp.save(productInfo);
	}

	@Override
	public void addProductInfo(ProductInfo productInfo) {
		// TODO Auto-generated method stub

	}

	@Override
	public void deleteProductInfo(ProductInfo productInfo) {
		// TODO Auto-generated method stub

	}

}
